package com.tantinevincent.vector;

/**
 * Package a vector and it's label in this class.
 * @author Vincent
 *
 */
public class LabeledVector implements IVector{

	/**
	 * Base vector, all vector operator will swap to this vector.
	 */
	private IVector baseVector;
	/**
	 * The label of vector, will be -1, 1, or the other integer.
	 */
	private int label;
	/**
	 * Initialize vector by base vector and it's label.
	 * @param v the base vector.
	 * @param label the label of vector.
	 */
	public LabeledVector(IVector v,int label ){
		this.baseVector = v;
		this.label = label;
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public int length() {
		return baseVector.length();
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public int[] getIndices() {
		return baseVector.getIndices();
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public double get(int index) {
		return baseVector.get(index);
	}
	/**
	 * Get the label of vector.
	 * @return the label of vector.
	 */
	public int getLabel(){
		return label;
	}
	/**
	 * Get base vector of this vector
	 * @return base vector.
	 */
	public IVector getBaseVector(){
		return baseVector;
	}
}
